package com.qianfeng.dao.impl;

import java.util.Date;
import java.util.List;

import com.qianfeng.commons.DBUtils;
import com.qianfeng.dao.IOrderDao;
import com.qianfeng.entity.Order;
import com.qianfeng.entity.OrderDetail;


public class OrderDaoImpl extends DBUtils<Order> implements IOrderDao {

	@Override
	public void addOrder(Order o) {
		String sql = "insert into t_order values(?,?,?,?,?,?,null,null,?,?,?,?)";
		super.commonOper(sql, o.getId(), o.getO_sendtype(), o.getO_paytype(), o.getO_paycount(), new Date(), 1,
				o.getUserid(), o.getO_shperson(), o.getO_shphone(), o.getO_shaddress());
	}

	@Override
	public Order getOrderById(int orderid) {
		String sql = "select * from t_order where id = ?";
		return super.getSingleInstance(sql, Order.class, orderid);
	}

	@Override
	public int querycount() {
		String sql="SELECT count(*) from t_order";
		return super.getCount(sql);
	}

	@Override
	public List<Order> queryfenye(int rowIndex, int pageSize) {
		String sql="SELECT * from t_order limit ?,?";
		return super.getList(sql, Order.class, rowIndex,pageSize);
	}



}
